﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WCS.Infrastructure.Dto.Request.Epaylinks
{

    /// <summary>
    /// 商户信息
    /// </summary>
    public class EpaylinksMerchantInfo
    {
        /// <summary>
        /// 版本号，默认 1.0 版本，使用本文档请传 2.0，长度限制为 5
        /// </summary>
        [MaxLength(5)]
        public string Version { get; set; }

        /// <summary>
        /// 平台商户编号，易票联给平台商户分配的唯一 ID，长度限制为 20
        /// </summary>
        [MaxLength(20)]
        public string AcqSpId { get; set; }

        /// <summary>
        /// 商户编号，补件时必传，长度限制为 20
        /// </summary>
        [MaxLength(20)]
        public string? AcqMerId { get; set; }

        /// <summary>
        /// 商户侧唯一标识，长度限制为 50
        /// </summary>
        [MaxLength(50)]
        public string MerId { get; set; }

        /// <summary>
        /// 审核结果通知地址，长度限制为 200
        /// </summary>
        [MaxLength(200)]
        public string BackUrl { get; set; }

        /// <summary>
        /// 商户注册名称，长度限制为 100
        /// </summary>
        [MaxLength(100)]
        public string MerchantName { get; set; }

        /// <summary>
        /// 商户详细信息，密文，加密方法参考“敏感信息加密”，JSON 字符串类型
        /// </summary>
        public EpaylinksPaper Paper { get; set; }

        /// <summary>
        /// 是否收单，1 是，0 否
        /// </summary>
        public string AcceptOrder { get; set; }

        /// <summary>
        /// 业务开通信息，参考业务申请接口内的“business 定义”
        /// </summary>
        public List<EpaylinksBusinessInfo> Business { get; set; }

        /// <summary>
        /// 业务启停回调地址，易票联启用或禁用商户业务后的通知地址（回调平台商户的地址），长度限制为 200
        /// </summary>
        [MaxLength(200)]
        public string BusinessBackUrl { get; set; }

        
        
        // 构造函数，根据需要初始化必要的属性
        public EpaylinksMerchantInfo()
        {
            // 可以在这里进行一些默认值的设置等操作
        }
    }

    /// <summary>
    /// 商户详细信息
    /// 密文，加密方法参考“敏感信息加密”
    /// </summary>
    public class EpaylinksPaper
    {
        /// <summary>
        /// 商户简称
        /// </summary>
        [MaxLength(40)]
        public string ShortName { get; set; }

        /// <summary>
        /// 主体类型(1：个体工商户；2：企业；3：个人(小微)；4：政店事业单位；9：其他组织)
        /// </summary>
        public string MerchantType { get; set; }
        /// <summary>
        /// 是否个人独资企业
        /// merchantType=2 时有效
        /// 1：是；
        /// 0：否（默认）；
        /// </summary>
        public int SoleInvestor { get; set; }
        /// <summary>
        /// 联系人信息
        /// </summary>
        public EpaylinksContactInfo ContactInfo { get; set; }

        /// <summary>
        /// 经营信息
        /// </summary>
        public EpaylinksCompanyInfo CompanyInfo { get; set; }

        /// <summary>
        /// 法人信息
        /// </summary>
        public EpaylinksLawyerInfo LawyerInfo { get; set; }

        /// <summary>
        /// 注册账户信息
        /// </summary>
        public EpaylinksOpenAccountInfo OpenAccountInfo { get; set; }

        /// <summary>
        /// 结算账户信息
        /// </summary>
        public EpaylinksSettlementAccountInfo SettleAccountInfo { get; set; }

        /// <summary>
        /// 受益人信息，List 最多 4 个元素
        /// </summary>
        public List<EpaylinksControllerInfo> ControllerList { get; set; }

        /// <summary>
        /// 其他信息
        /// </summary>
        public EpaylinksOtherInfo? OtherInfo { get; set; }
    }

    /// <summary>
    /// 易票联商户信息请求参数
    /// </summary>
    public class EpaylinksMerchantInfoRequestDto
    {

        /// <summary>
        /// 版本号，默认 1.0 版本，使用本文档请传 2.0，长度限制为 5
        /// </summary>
        [MaxLength(5)]
        public string? Version { get; set; } = "2.0";

        /// <summary>
        /// 商户编号，补件时必传，长度限制为 20
        /// </summary>
        [MaxLength(20)]
        public string? AcqMerId { get; set; }

        /// <summary>
        /// 商户侧唯一标识，长度限制为 50
        /// </summary>
        [MaxLength(50)]
        public string? MerId { get; set; }

        /// <summary>
        /// 审核结果通知地址，长度限制为 200
        /// </summary>
        [MaxLength(200)]
        public string? BackUrl { get; set; }

        /// <summary>
        /// 商户注册名称，长度限制为 100
        /// </summary>
        [MaxLength(100)]
        public string? MerchantName { get; set; }

       
        /// <summary>
        /// 商户详细信息，密文，加密方法参考“敏感信息加密”，JSON 字符串类型
        /// </summary>
        public EpaylinksPaper? Paper { get; set; }


        /// <summary>
        /// 是否收单，1 是，0 否
        /// </summary>
        public string? AcceptOrder { get; set; }

        /// <summary>
        /// 业务开通信息，参考业务申请接口内的“business 定义”
        /// </summary>
        public List<EpaylinksBusinessInfo>? Business { get; set; }

        /// <summary>
        /// 业务启停回调地址，易票联启用或禁用商户业务后的通知地址（回调平台商户的地址），长度限制为 200
        /// </summary>
        [MaxLength(200)]
        public string? BusinessBackUrl { get; set; }


        ///// <summary>
        ///// 平台商户编号，易票联给平台商户分配的唯一 ID，长度限制为 20
        ///// </summary>
        //[MaxLength(20)]
        //public string AcqSpId { get; set; }

        ///// <summary>
        ///// 商户详细信息，密文，加密方法参考“敏感信息加密”，JSON 字符串类型
        ///// </summary>
        //public new string Paper { get; set; }
    }

    /// <summary>
    /// 商户审核结果通知请求参数
    /// </summary>
    public class MerchantAuditResultNotificationRequest
    {
        /// <summary>
        /// 版本号，默认 1.0 版本，使用本文档请传 2.0
        /// </summary>
        public string? version { get; set; }

        /// <summary>
        /// 平台商户编号，易票联给平台商户分配的唯一 ID
        /// </summary>
        public string acqSpId { get; set; }

        /// <summary>
        /// 商户编号
        /// </summary>
        public string acqMerId { get; set; }

        /// <summary>
        /// 商户侧唯一标识
        /// </summary>
        public string merId { get; set; }

        /// <summary>
        /// 审核状态，1：待审核，2：审核通过，3：审核不通过
        /// </summary>
        public string auditStatus { get; set; }

        /// <summary>
        /// 审核说明
        /// </summary>
        public string? auditMsg { get; set; }

        /// <summary>
        /// 审核时间，格式：yyyyMMddHHmmss
        /// </summary>
        public string? auditTime { get; set; }
    }

    /// <summary>
    /// 查询商户进件信息请求参数
    /// </summary>
    public class QueryMerchantInfoRequestDto
    {
        /// <summary>
        /// 版本号，默认 1.0 版本，使用本文档请传 2.0，长度限制为 5
        /// </summary>
        [MaxLength(5)]
        public string? Version { get; set; } = "2.0";

        /// <summary>
        /// 平台商户编号
        /// </summary>
        [MaxLength(20)]
        public string? AcqSpId { get; set; }

        /// <summary>
        /// 商户编号，补件时必传，长度限制为 20
        /// </summary>
        [MaxLength(20)]
        public string? AcqMerId { get; set; }
        /// <summary>
        /// 商户侧唯一标识，长度限制为 50
        /// </summary>
        [MaxLength(50)]
        public string? MerId { get; set; }

    }

    /// <summary>
    /// 查询商户进件信息响应参数
    /// </summary>
    public class QueryMerchantInfoResponseDto
    {
        public string? AcqSpId { get; set; }

        public string? MerId { get; set; }

        public string? AcqMerId { get; set; }

        public string? RespCode { get; set; }
        public string? RespMsg { get; set; }
        public string? AccountStatus { get; set; }
        public string? AuditStatus { get; set; }
        public string? AuditMsg { get; set; }
        public string? ChannelMchtNo { get; set; }
        public string? Paper { get; set; }
    }

    public class SettleAccountDto
    {
        public string? SettleAccountNo { get; set; }
        public string? SettleAccountType { get; set; }
        public string? OpenBank { get; set; }
        public string? OpenSubBank { get; set; }
        public string? OpenBankCode { get; set; }
        public string? OpenBankReservePhone { get; set; }
        public string? Postscript { get; set; }
        public string? ContractStatus { get; set; }
        public string? Remarks { get; set; }
    }
}
